<script setup lang="ts">
import ItemWrap from "@/components/item-wrap";
import LeftTop from "./left-top.vue";
import LeftCenter from "./left-center.vue";
import LeftBottom from "./left-bottom.vue";
import CenterMap from "./center-map.vue";
import CenterBottom from "./center-bottom.vue";
import RightTop from "./right-top.vue";
import RightCenter from "./right-center.vue";
import RightBottom from "./right-bottom.vue";
</script>

<template>
  <div class="index-box">
    <div class="contetn_left">
      <!-- <div class="pagetab">
        <div class="item">实时监测</div>
        <div class="item">统计分析</div>
      </div> -->
      <ItemWrap class="contetn_left-top contetn_lr-item" title="年龄分布">
        <LeftTop />
      </ItemWrap>
      <ItemWrap class="contetn_left-center contetn_lr-item" title="患者性别分布">
        <LeftCenter />
      </ItemWrap>
      <ItemWrap
        class="contetn_left-bottom contetn_lr-item"
        title="患者年龄分布"
        style="padding: 0 10px 16px 10px"
      >
        <LeftBottom />
      </ItemWrap>
    </div>
    <div class="contetn_center">
      <CenterMap class="contetn_center_top" title="参与计划分布图" />
      <ItemWrap class="contetn_center-bottom" title="高血压患者分级统计">
        <CenterBottom />
      </ItemWrap>
    </div>
    <div class="contetn_right">
      <ItemWrap class="contetn_left-bottom contetn_lr-item" title="病人信息统计">
        <RightTop />
      </ItemWrap>
      <ItemWrap
        class="contetn_left-bottom contetn_lr-item"
        title="心血管风险分层"
        style="padding: 0 10px 16px 10px"
      >
        <RightCenter />
      </ItemWrap>
      <!-- <ItemWrap class="contetn_left-bottom contetn_lr-item" title="数据统计图 ">
        <RightBottom />
      </ItemWrap> -->
    </div>
  </div>
</template>

<style scoped lang="scss">
.index-box {
  width: 100%;
  display: flex;
  height: calc(100vh - 80px);
  min-height: 800px;
  justify-content: space-between;
  gap: 15px;
  padding: 0 10px;
  box-sizing: border-box;
  font-weight: bold;
}

.contetn_left {
  display: flex;
  flex-direction: column;
  width: 500px;
  height: 100%;
  padding: 12px;
  box-sizing: border-box;
  
  .contetn_lr-item {
    flex: 1;
    min-height: 300px;
    margin: 6px 0;
    
    &:first-child { margin-top: 0; }
    &:last-child { margin-bottom: 0; }
  }
}

.contetn_right {
  display: flex;
  flex-direction: column;
  width: 500px;
  height: 100%;
  padding: 12px;
  box-sizing: border-box;
  
  
  .contetn_lr-item {
    margin: 6px 0;
    
    &:first-child {
      flex: 2; // 占2份高度
      min-height: 500px;
    }
    
    &:last-child {
      flex: 1; // 占1份高度
      min-height: 250px; // 确保最小高度
      height: auto !important; // 强制高度自适应
    }
    
    &:first-child { margin-top: 0; }
    &:last-child { margin-bottom: 0; }
  }
}

.contetn_center {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  
  .contetn_center-top {
    flex: 1;
    min-height: 400px;
    margin-bottom: 12px;
  }
  
  .contetn_center-bottom {
    height: 300px;
    flex-shrink: 0;
  }
}

// 强制右下组件占满可用空间
.contetn_right .contetn_lr-item:last-child {
  display: flex;
  flex-direction: column;
  
  & > * {
    flex: 1;
    min-height: 200px;
    overflow: hidden;
  }
}

.contetn_lr-item > * {
  width: 100%;
  height: 100%;
}
</style>